#ifndef EVENTMANAGER_H
#define EVENTMANAGER_H

#include <QObject>
#include <QFile>
#include <QMap>
#include "Event.h"
#include "IPlugin.h"

class EventManager : public QObject
{
   Q_OBJECT

public:
   explicit EventManager(QString eventPath,
                         QObject *parent = 0);

   void reportEvents();

signals:
   void signalEventNotification(Event event);

public slots:
   void slotRegisterPlugin(Plugin *plugin);
   void slotPublishEvent(Event event);
   void slotSubscribeEvent(quint32 id);
   void slotUnsubscribeEvent(quint32 id);

protected:
   bool recordEvent(Event event);
   bool findEvent(Event event);
   Event::Category getCategory(QString category);

   QMap<Plugin*, QList<quint32> > theEventSubscriptions;
   QFile theEventTable;
};

#endif // EVENTMANAGER_H
